<MultiSelect Items="@Items" @bind-Value="@SelectedItemsValue" OnSelectedItemsChanged="@OnSelectedItemsChanged" />
<Logger @ref="Trace" class="mt-3" />

@code {
    /// <summary>
    /// 获得 默认数据集合
    /// </summary>
    private readonly IEnumerable<SelectedItem> Items = new SelectedItem[]
    {
        new SelectedItem ("Beijing", "北京"),
        new SelectedItem ("Shanghai", "上海"),
        new SelectedItem ("Guangzhou", "广州"),
        new SelectedItem ("Shenzhen", "深圳"),
        new SelectedItem ("Chengdu", "成都"),
        new SelectedItem ("Wuhan", "武汉"),
        new SelectedItem ("Dalian", "大连"),
        new SelectedItem ("Hangzhou", "杭州"),
        new SelectedItem ("Lianyungang", "连云港"),
    };
    
    private string SelectedItemsValue { get; set; } = "Beijing,Chengdu";

    private Task OnSelectedItemsChanged(IEnumerable<SelectedItem> items)
    {
        Trace?.Log($"选中项集合：{string.Join(",", items.Select(i => i.Value))}");
        return Task.CompletedTask;
    }
}
